function Tests = modelAutoexogeniseTest()
Tests = functiontests(localfunctions);
end
%#ok<*DEFNU>


%**************************************************************************


function testAutoexogenise1(This)
m = model('testAutoexogenise.model');
p = plan(m,1:10);
p = autoexogenise(p,'x',1:5);
p = autoexogenise(p,'y',2:6);
p = autoexogenise(p,'z',3:7);

expXAnch = false(4,10);
expXAnch(1,1:5) = true;
expXAnch(2,2:6) = true;
expXAnch(3,3:7) = true;

assertEqual( This, p.XAnch, expXAnch );
end % testAutoexogenise()


%**************************************************************************


function testAutoexogenise2(This)
m = model('testAutoexogenise.model');
p = plan(m,1:10);
p = autoexogenise(p,{'x','y'},1:5);

expXAnch = false(4,10);
expXAnch(1:2,1:5) = true;
assertEqual( This, p.XAnch, expXAnch );
end % testAutoexogenise()


%**************************************************************************


function testAutoexogenise3(This)
m = model('testAutoexogenise.model');
p = plan(m,1:10);
p = autoexogenise(p,{'x','y','z'},1:5);

expXAnch = false(4,10);
expXAnch(1:3,1:5) = true;
assertEqual( This, p.XAnch, expXAnch );
end % testAutoexogenise()


%**************************************************************************


function testAutoexogeniseAll(This)
m = model('testAutoexogenise.model');
p = plan(m,1:10);
p = autoexogenise(p,@all,1:5);

expXAnch = false(4,10);
expXAnch(1:3,1:5) = true;
assertEqual( This, p.XAnch, expXAnch );
end % testAutoexogeniseAll()


%**************************************************************************


function testAutoexogeniseErr(This)
m = model('testAutoexogenise.model');
p = plan(m,1:10);

isErr = false;
try
    p = autoexogenise(p,'a',1:5);
catch
    isErr = true;
end

expXAnch = false(4,10);

assertEqual( This, isErr, true );
assertEqual( This, p.XAnch, expXAnch );
end % testAutoexogeniseAll()
